From 2724e1178d4df746cae1950eb4a9f9f968b54d17 Mon Sep 17 00:00:00 2001 From: "awilliam@xenbuild.aw" Date: Mon, 10 Jul 2006 14:11:44 -0600 Subject: [PATCH] [IA64] fix vcpu_itr_i(), vcpu_itr_d() and vcpu_flush_tlb_vhpt_range() callers - vcpu_itr_i() and vcpu_itr_d() must purge vTLB entry which overlaps the new inserted entry. - some address argument of vcpu_flush_tlb_vhpt_range() was wrong. Signed-off-by: Isaku Yamahata --- xen/arch/ia64/xen/faults.c | 3 +-- xen/arch/ia64/xen/vcpu.c | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/xen/arch/ia64/xen/faults.c b/xen/arch/ia64/xen/faults.c index 0c2d047915..b30470e6ab 100644 --- a/xen/arch/ia64/xen/faults.c +++ b/xen/arch/ia64/xen/faults.c @@ -208,8 +208,7 @@ void ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_reg p2m_entry_retry(&entry)) { /* dtlb has been purged in-between. This dtlb was matching. Undo the work. */ - vcpu_flush_tlb_vhpt_range(address & ((1 << logps) - 1), - logps); + vcpu_flush_tlb_vhpt_range(address, logps); // the stale entry which we inserted above // may remains in tlb cache. diff --git a/xen/arch/ia64/xen/vcpu.c b/xen/arch/ia64/xen/vcpu.c index d820c7faf6..e9dda6341f 100644 --- a/xen/arch/ia64/xen/vcpu.c +++ b/xen/arch/ia64/xen/vcpu.c @@ -1906,10 +1906,16 @@ IA64FAULT vcpu_itr_d(VCPU *vcpu, UINT64 slot, UINT64 pte, TR_ENTRY *trp; if (slot >= NDTRS) return IA64_RSVDREG_FAULT; + + vcpu_purge_tr_entry(&PSCBX(vcpu, dtlb)); + trp = &PSCBX(vcpu,dtrs[slot]); //printf("***** itr.d: setting slot %d: ifa=%p\n",slot,ifa); vcpu_set_tr_entry(trp,pte,itir,ifa); vcpu_quick_region_set(PSCBX(vcpu,dtr_regions),ifa); + + vcpu_flush_tlb_vhpt_range(ifa & itir_mask(itir), itir_ps(itir)); + return IA64_NO_FAULT; } @@ -1919,10 +1925,16 @@ IA64FAULT vcpu_itr_i(VCPU *vcpu, UINT64 slot, UINT64 pte, TR_ENTRY *trp; if (slot >= NITRS) return IA64_RSVDREG_FAULT; + + vcpu_purge_tr_entry(&PSCBX(vcpu, itlb)); + trp = &PSCBX(vcpu,itrs[slot]); //printf("***** itr.i: setting slot %d: ifa=%p\n",slot,ifa); vcpu_set_tr_entry(trp,pte,itir,ifa); vcpu_quick_region_set(PSCBX(vcpu,itr_regions),ifa); + + vcpu_flush_tlb_vhpt_range(ifa & itir_mask(itir), itir_ps(itir)); + return IA64_NO_FAULT; } @@ -1990,7 +2002,7 @@ again: vcpu_itc_no_srlz(vcpu,2,ifa,pteval,pte,logps); if (swap_rr0) set_metaphysical_rr0(); if (p2m_entry_retry(&entry)) { - vcpu_flush_tlb_vhpt_range(ifa & ((1 << logps) - 1), logps); + vcpu_flush_tlb_vhpt_range(ifa, logps); goto again; } return IA64_NO_FAULT; @@ -2013,7 +2025,7 @@ again: vcpu_itc_no_srlz(vcpu, 1,ifa,pteval,pte,logps); if (swap_rr0) set_metaphysical_rr0(); if (p2m_entry_retry(&entry)) { - vcpu_flush_tlb_vhpt_range(ifa & ((1 << logps) - 1), logps); + vcpu_flush_tlb_vhpt_range(ifa, logps); goto again; } return IA64_NO_FAULT; -- 2.30.2